package com.project.androidjukebox;
 
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
 
public class ClientTab extends ListActivity {
	
	public static ArrayList<HashMap<String, String>> voteSongs = new ArrayList<HashMap<String, String>>();		
	Server s = new Server();
	
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.client_layout);
    
     // Adding mp3 files to list
    	
		ListAdapter adapter = new SimpleAdapter(ClientTab.this, s.getList(),
				R.layout.votelistitem,
				new String[] { "Name", "Votes" }, new int[] {
						R.id.voteTitle, R.id.votevotes});

		setListAdapter(adapter);
       
    }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
    	s.setVote(position);
    	Toast toast=Toast.makeText(this, "Vote casted", 2000);
    	     toast.show();

    }
}